# Maintainer: Sam Day <me@samcday.com>
pkgname=greetd-phrog
pkgver=0.42.0
pkgrel=0
pkgdesc="Mobile device greeter"
url=https://github.com/samcday/phrog
# riscv64: blocked by greetd
# s390x: blocked by greetd & phosh
# ppc64le: blocked by phosh
# armhf: blocked by phosh
arch="all !s390x !riscv64 !armhf !ppc64le"
license="GPL-3.0-only"
depends="
	phosh
	greetd
	greetd-phrog-schemas
	libphosh"
makedepends="
	cargo
	cargo-auditable
	libphosh-dev"
checkdepends="xvfb-run"

source="https://github.com/samcday/phrog/archive/$pkgver/phrog-$pkgver.tar.gz"
subpackages="$pkgname-schemas::noarch"
builddir="$srcdir/phrog-$pkgver"
options="net" # cargo fetch

export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix=$builddir=/build/"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

package() {
	install -Dm755 resources/mobi.phosh.phrog.gschema.xml -t "$pkgdir"/usr/share/glib-2.0/schemas/
	install -Dm755 target/release/phrog -t "$pkgdir"/usr/bin/
}

check() {
	export XDG_RUNTIME_DIR=/tmp
	dbus-run-session xvfb-run -a phoc -E "cargo test --frozen"
}

schemas() {
	pkgdesc="Phrog schema files"
	depends=""
	amove usr/share/glib-2.0/schemas
}
sha512sums="
1db152d53d99fe36e3e3a027b008745d62b27b44b355372609b343665b54ba2fcee8943ec20f4570d963e3a92ea0966336949b0dcd94a6417255bb1f53524a36  phrog-0.42.0.tar.gz
"
